home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Dema / betonsoldier_spdemo.exe / {app} / Shaders / mesh_fluid.fx < prev    next >
Encoding:
Text File  |  2005-05-05  |  4.5 KB  |  121 lines

  1. //------------------------------------------------------------------------------------------------------
  2. //------------------------------------------------------------------------------------------------------
  3. //------------------------------------------------------------------------------------------------------
  4.  
  5. #include "shared.fx"
  6. #include "lighting.fx"
  7. #define FOG_DISABLE // c'est mieux parce que sinon le gui il est fogguΘ et c'est pas terrible...
  8. #include "fog.fx"
  9.  
  10.  
  11. //------------------------------------------------------------------------------------------------------
  12. //- Static parameters
  13. //------------------------------------------------------------------------------------------------------
  14.  
  15. float dummyParam;
  16.  
  17. float3 light = {0, 10, 10};
  18.  
  19. //------------------------------------------------------------------------------------------------------
  20. //------------------------------------------------------------------------------------------------------
  21. //------------------------------------------------------------------------------------------------------
  22.  
  23. struct    CVertexShaderInput
  24. {
  25.     float4    Position    :    POSITION;
  26.     float3    Normal        :    NORMAL;    
  27. };
  28.  
  29. //------------------------------------------------------------------------------------------------------
  30.  
  31. struct    CVertexShaderOutput
  32. {
  33.     float4    Position            :    POSITION;
  34.     float3  Normal                :    TEXCOORD0;
  35.     float3  Light                :    TEXCOORD1;
  36. };
  37.  
  38. //------------------------------------------------------------------------------------------------------
  39. //------------------------------------------------------------------------------------------------------
  40. //------------------------------------------------------------------------------------------------------
  41.  
  42. CVertexShaderOutput    OpaSelfIllumGeomTech1Pass1 (const CVertexShaderInput input)
  43. {
  44.     CVertexShaderOutput output;
  45.     
  46.     // output position into world+view+projection space
  47.     output.Position = mul(input.Position, WorldCameraProjection);
  48.     output.Light    = normalize(light);
  49.     output.Normal   = normalize(mul(input.Normal, World)); // transform Normal and normalize it             
  50.     //output.Normal   = input.Normal; // transform Normal and normalize it
  51.             
  52.     return output;
  53. }
  54.  
  55. float4 OpaSelfIllumGeomTech1Pass1PS(const CVertexShaderOutput output) : COLOR
  56. {
  57.     float4 diffuse = {    1.0f, 0.0f, 0.0f, 1.0f};
  58.     float4 ambient = {0.1, 0.0, 0.0, 1.0}; 
  59.     float4 color = max(0, (dot(output.Light, output.Normal)));
  60.     color.a = 1.0f;
  61.     return color;
  62. }
  63.  
  64.  
  65.  
  66. //------------------------------------------------------------------------------------------------------
  67. //------------------------------------------------------------------------------------------------------
  68. //------------------------------------------------------------------------------------------------------
  69.  
  70. #define RenderStates \
  71.     CullMode            = CCW; \
  72.     ZEnable            = true; \
  73.     ZFunc            = LESSEQUAL; \
  74.     ZWriteEnable        = true; \
  75.     AlphaBlendEnable    = false; \
  76.     AlphaTestEnable        = true; \
  77.     AlphaRef            = 192; \
  78.     AlphaFunc            = GREATEREQUAL ; \
  79.     FogEnable            = false
  80.     
  81. //------------------------------------------------------------------------------------------------------
  82. //------------------------------------------------------------------------------------------------------
  83. //------------------------------------------------------------------------------------------------------
  84.  
  85. technique    tech1
  86. <
  87.     int Priority = 1;
  88.     int TechniqueIndex = 0;
  89.     int DeviceType = HWSHADER_ONLY;
  90.     int LightingType = INTEGRATED_LIGHTING;
  91.     string RenderingType = "Standard";
  92. >
  93. {
  94.     pass pass1
  95.     {
  96.         RenderStates;
  97.  
  98.         VertexShader = compile vs_1_1 OpaSelfIllumGeomTech1Pass1();
  99.         
  100.         PixelShader = compile ps_2_0 OpaSelfIllumGeomTech1Pass1PS();
  101.         //asm
  102.         //{
  103.         //    ps_1_1
  104.             
  105.         //    def c0, 1.0, 0.0, 0.0, 1.0 
  106.                         
  107.         //    mov r0, c0
  108.         //};
  109.     }
  110. }
  111.  
  112. //------------------------------------------------------------------------------------------------------
  113. //------------------------------------------------------------------------------------------------------
  114. //------------------------------------------------------------------------------------------------------
  115.  
  116. #include "mesh_shadow.fx"
  117. #include "mesh_shadow_projector.fx"
  118.  
  119. //------------------------------------------------------------------------------------------------------
  120. //------------------------------------------------------------------------------------------------------
  121. //------------------------------------------------------------------------------------------------------